package com.vm.osm.business.dto.rsp.asset_equ;

import com.google.common.base.MoreObjects;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 企业设备详情
 *
 * @author Xuerong Xue
 */
@Data
public class AssetEquDetail implements Serializable {
    @ApiModelProperty("系统编号")
    private String id;
    @ApiModelProperty("设备编号")
    private String equ_code;
    @ApiModelProperty("设备类型（1：通用设备类型，2：专业设备类型）")
    private Byte equ_type;
    @ApiModelProperty("设备类型编号")
    private String equ_type_id;
    @ApiModelProperty("设备类型名称")
    private String equ_type_name;
    @ApiModelProperty("所属部门编号")
    private String department_id;
    @ApiModelProperty("所属部门名称")
    private String department_name;
    @ApiModelProperty("所属员工编号")
    private String staff_id;
    @ApiModelProperty("所属员工名称")
    private String staff_name;
    @ApiModelProperty("设备状态（1：闲置、2：在用、3：借用、4：报废、5：丢失、6：维护锁定、7：故障锁定）")
    private Byte status;
    @ApiModelProperty(value = "通用属性列表", dataType = "AssetEquDetail.CommonAttr")
    private List<CommonAttr> common_attrs;
    @ApiModelProperty(value = "自定义属性列表", dataType = "AssetEquDetail.DiyAttr")
    private List<DiyAttr> diy_attrs;
    @ApiModelProperty(value = "配件列表", dataType = "AssetEquDetail.EquPart")
    private List<EquPart> parts;

    @Data
    @ApiModel("AssetEquDetail.CommonAttr")
    public static class CommonAttr implements Serializable {
        @ApiModelProperty("属性字段")
        private String attr_field;
        @ApiModelProperty("属性值")
        private String attr_val;

        @Override
        public String toString() {
            return MoreObjects.toStringHelper(this)
                    .add("attr_field", attr_field)
                    .add("attr_val", attr_val)
                    .toString();
        }
    }

    @Data
    @ApiModel("AssetEquDetail.DiyAttr")
    public static class DiyAttr implements Serializable {
        @ApiModelProperty("属性Id")
        private String id;
        @ApiModelProperty("属性字段")
        private String attr_field;
        @ApiModelProperty("属性值")
        private String attr_val;

        @Override
        public String toString() {
            return MoreObjects.toStringHelper(this)
                    .add("id", id)
                    .add("attr_field", attr_field)
                    .add("attr_val", attr_val)
                    .toString();
        }
    }

    @Data
    @ApiModel("AssetEquDetail.EquPart")
    public static class EquPart implements Serializable {
        @ApiModelProperty("品牌")
        private String brand;
        @ApiModelProperty("配件类型编号")
        private String equ_part_type_id;
        @ApiModelProperty("配件类型名称")
        private String equ_part_type_name;
        @ApiModelProperty("生产厂家")
        private String manufactor_id;
        @ApiModelProperty("计量单位")
        private String measure_unit;
        @ApiModelProperty("型号")
        private String model;
        @ApiModelProperty("原值")
        private String original_value;
        @ApiModelProperty("pn")
        private String pn;
        @ApiModelProperty("购买日期")
        private Integer purchase_date;
        @ApiModelProperty("sn")
        private String sn;
        @ApiModelProperty("规格")
        private String spec;
        @ApiModelProperty("规格")
        private String supplier_id;
        @ApiModelProperty("质保")
        private Integer warranty_date;

        @Override
        public String toString() {
            return MoreObjects.toStringHelper(this)
                    .add("brand", brand)
                    .add("equ_part_type_id", equ_part_type_id)
                    .add("manufactor_id", manufactor_id)
                    .add("measure_unit", measure_unit)
                    .add("model", model)
                    .add("original_value", original_value)
                    .add("pn", pn)
                    .add("purchase_date", purchase_date)
                    .add("sn", sn)
                    .add("spec", spec)
                    .add("supplier_id", supplier_id)
                    .add("warranty_date", warranty_date)
                    .toString();
        }
    }
}
